#ifndef _MEM_MANAGER_H_
#define _MEM_MANAGER_H_

#include <stdlib.h>
#include <string.h>

#define g_alloc(ptr, type) {ptr = new type;}
#define g_allocv(ptr, type, count) {ptr = new type[count];}
#define g_free(ptr) {if (ptr) {delete ptr; ptr = NULL;}}
#define g_freev(ptr) {if (ptr) {delete[] ptr; ptr = NULL;}}
#define g_strdup(dest, src) {g_allocv(dest, char, strlen(src)+1);dest=strcpy(dest,src);}

#endif _MEM_MANAGER_H_